function selectedPathsToSvg(selectedPathsArray){

	var strokeWidth = 0.05;
	var pixelToMillimeterConversionRatio = 3.543299873306695;
	var svgId = "svg" + Math.round(Math.random() * Math.pow(10, 17));

	// Select layers to draw from layers list and add its paths to svg 
	var svg = "";

	for(var i = 0; i < selectedPathsArray.length; i++){
		svg += selectedPathsArray[i].paths;
	}

	svg = '<svg {0} version="1.1" xmlns="http://www.w3.org/2000/svg">\n' +
		'<g transform="scale({0},-{0})" '.format(pixelToMillimeterConversionRatio) +
		' style="stroke:black; stroke-width:0.1; stroke-linecap:round; stroke-linejoin:round; fill:none">\n' +
		svg +
		'</g>\n' +
		'</svg>\n';

	// The SVG has to be added to the DOM to be able to retrieve its bounding box.
	$(svg.format('id="' + svgId + '"')).appendTo('body');
	var boundingBox = $('svg')[0].getBBox();
	var viewBoxValue = '{0} {1} {2} {3}'.format(boundingBox.x-strokeWidth/2, boundingBox.y-strokeWidth/2,
												boundingBox.width+strokeWidth, boundingBox.height+strokeWidth);
	$('#'+svgId).remove();

	return svg.format('viewBox="' + viewBoxValue + '"');
}

